/*  This file is part of -_-.

    -_- is free software: you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
    the Free Software Foundation, either version 3 of the License, or
    (at your option) any later version.

    -_- is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU General Public License for more details.

    You should have received a copy of the GNU General Public License
    along with -_-.  If not, see <http://www.gnu.org/licenses/>.

    Copyright 2012-2013 Oliver Katz */

#ifndef __OPAL_MACROS_H
#define __OPAL_MACROS_H

#include <map>
#include "parser.h"

//namespace sleepyface::opal
namespace sleepyface
{
    namespace opal
    {
        //class FunctionalMacro: a macro that takes the form of a function
        class FunctionalMacro
        {
        private:
            string symbol;
            vector<string> arguments;
            AST macro;

            AST evaluateArguments(AST ast, map<string, AST> args);

        public:
            FunctionalMacro(); //methodof FunctionalMacro: initializer
            FunctionalMacro(string s, AST m); //methodof FunctionalMacro: initializer with symbol and body
            int addArgument(string a); //methodof FunctionalMacro: adds an argument name to the macro
            string getArgument(int idx); //methodof FunctionalMacro: gets the macro at index 'idx'
            int size(); //methodof FunctionalMacro: gets the number of arguments
            AST evaluate(AST src, map<string, AST> args); //methodof FunctionalMacro: evaluates recursively on 'src'
        };
    }
}

#endif